
(function () {
    var core = ecui,
        util = core.util,
        ui = ecui.ui,
        dom = ecui.dom;

    Object.assign(
        NS.data,
        {
        }
    );
    Object.assign(
        NS.ui,
        {
            DeleteBtn: ecui.inherits(
                ui.Control,
                function (el, options) {
                    ui.Control.call(this, el, options);
                    this._sOptId = options.optId;
                },
                {
                    onclick: function () {
                        var me = this;
                        ecui.confirm(
                            '是否删除订场？',
                            function () {
                                if (this._bSending) {
                                    return;
                                }
                                me._bSending = true;
                                ecui.esr.request(
                                    'data@POST /erp-management/project/del-round/' + me._sOptId,
                                    function () {
                                        var data = ecui.esr.getData('data');
                                        if (data instanceof Object) {
                                            me._bSending = false;
                                            delete ecui.esr.getRoute('/venueOrder/calendar').CACHE;
                                            ecui.tip('warn', '删除成功');
                                            history.go(-1);
                                        }
                                    },
                                    function () {
                                        me._bSending = false;
                                    }
                                );
                            },
                            function () {
                            }
                        );
                    }
                }
            )
        }
    );
    ecui.esr.addRoute('scene', {
        model: ['detail@GET /erp-management/project/modify-round/${id}'],
        weight: 4,
        frame: true,
        CACHE: false,
        onbeforerequest: function (context) {
            if (ecui.$('venue_scene_edit')) {
                ecui.$('venue_scene_edit').href = '#/venueOrder/edit~id=' + context.id;
            }
        },
        onbeforerender: function (context) {
            context.detail.musiciansName = context.detail.musicianNameList.join('，');
        },
        onafterrender: function (context) {
        }
    });
}());

